//------------------------------------------------------------------------------
// Copyright (c) 2008 www.dnaide.com
// Licensed under the MIT (MIT-LICENSE.txt)
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.IO;
using System.Web;

namespace DNAide.Configuration
{

	/// <summary>
	/// DNAide WebConfig section
	/// </summary>
	public class WebConfig : ConfigurationSection
	{
		/// <summary>
		/// WebConfig
		/// </summary>
		public WebConfig()
		{
		}

		[ConfigurationProperty("cacheUrl", DefaultValue="~/DNAide_Cache")]
		public String CacheUrl
		{
			get
			{
				return (string)this["cacheUrl"];
			}
			set
			{
				if (value.EndsWith("/"))
					value = value.Substring(0, value.Length - 1);
				this["cacheUrl"] = value;
			}
		}


		public String CachePhysicalPath
		{
			get
			{
				return HttpContext.Current.Server.MapPath(this.CacheUrl);
			}
		}


		/// <summary>
		/// UrlRewriter settings
		/// </summary>
		[ConfigurationProperty("urlRewriter")]
		public UrlRewriterConfig UrlRewriter
		{
			get
			{
				return (UrlRewriterConfig)this["urlRewriter"];
			}
			set
			{
				this["urlRewriter"] = value;
			}
		}

		/// <summary>
		/// ViewStateModule settings
		/// </summary>
		[ConfigurationProperty("viewStateModule")]
		public ViewStateModuleConfig ViewStateModule
		{
			get
			{
				return (ViewStateModuleConfig)this["viewStateModule"];
			}
			set
			{
				this["viewStateModule"] = value;
			}
		}

		/// <summary>
		/// HttpErrorModule settings
		/// </summary>
		[ConfigurationProperty("httpErrorModule")]
		public HttpErrorModuleConfig HttpErrorModule
		{
			get
			{
				return (HttpErrorModuleConfig)this["httpErrorModule"];
			}
			set
			{
				this["httpErrorModule"] = value;
			}
		}


		[ConfigurationProperty("httpCompressionModule")]
		public HttpCompressionModuleConfig HttpCompressionModule
		{
			get
			{
				return (HttpCompressionModuleConfig)this["httpCompressionModule"];
			}
			set
			{
				this["httpCompressionModule"] = value;
			}
		}

		

		/// <summary>
		/// ScriptAide settings
		/// </summary>
		[ConfigurationProperty("scriptAide")]
		public ScriptAideConfig ScriptAide
		{
			get
			{
				return (ScriptAideConfig)this["scriptAide"];
			}
			set
			{
				this["scriptAide"] = value;
			}
		}


		/// <summary>
		/// StyleAide settings
		/// </summary>
		[ConfigurationProperty("styleAide")]
		public StyleAideConfig StyleAide
		{
			get
			{
				return (StyleAideConfig)this["styleAide"];
			}
			set
			{
				this["styleAide"] = value;
			}
		}
	}

}
